//
//  RankingTableViewCell.m
//  IntegralDog
//
//  Created by wmm on 16/1/27.
//  Copyright © 2016年 hanen. All rights reserved.
//

#import "RankingTableViewCell.h"
#import "Macro.h"

#define CELLH 60
@implementation RankingTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        self.clipsToBounds = YES;
        //选中单元格
        //        UIView *bgView = [[UIView alloc] init];
        //        bgView.backgroundColor = [UIColor colorWithRed:(20.0f/255.0f) green:(30.0f/255.0f) blue:(40.0f/255.0f) alpha:0.5f];
        //        self.selectedBackgroundView = bgView;
        
        self.imageView.contentMode = UIViewContentModeCenter;
        
        
        CGFloat cellY = 10;
        CGFloat startX = [UIView getWidth:10];
        
        self.rankNumLab = [[UILabel alloc] initWithFrame:CGRectMake(startX, 2*cellY, [UIView getWidth:40], 20)];
        self.rankNumLab.font = [UIFont systemFontOfSize:14];
        self.rankNumLab.textColor = fontDarkGrayColor;
        self.rankNumLab.textAlignment = NSTextAlignmentRight;
        self.rankHeaderView = [[UIImageView alloc] initWithFrame:CGRectMake(_rankNumLab.maxX + [UIView getWidth:10], 10, CELLH - 2*10, CELLH - 2*10)];
        self.rankHeaderView.layer.cornerRadius = (CELLH - 2*10)/2;
        self.rankHeaderView.clipsToBounds = YES;
        
        UILabel *rankNCLab = [[UILabel alloc] initWithFrame:CGRectMake(self.rankHeaderView.maxX+[UIView getWidth:10], self.rankNumLab.y, 40, 20)];
        rankNCLab.font = [UIFont systemFontOfSize:14];
        rankNCLab.textColor = fontLightGrayColor;
        rankNCLab.text = @"昵称:";
        
        self.rankNameLab = [[UILabel alloc] initWithFrame:CGRectMake(rankNCLab.maxX, self.rankNumLab.y, 70, 20)];
        self.rankNameLab.font = [UIFont systemFontOfSize:14];
        self.rankNameLab.textColor = fontBlackColor;
        
        self.rankNumImgView = [[UIImageView alloc]init];
        
        UIImageView *rankImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth - [UIView getWidth:55], self.rankNumLab.y, 15, 18)];
        rankImageView.image = [UIImage imageNamed:@"rank_Jifenanniu"];
        
        self.rankIntegralLab = [[UILabel alloc] initWithFrame:CGRectMake(rankImageView.maxX + [UIView getWidth:5], self.rankNumLab.y, [UIView getWidth:50], 20)];
        self.rankIntegralLab.font = [UIFont systemFontOfSize:14];
        self.rankIntegralLab.textColor = mainOrangeColor;
        
        UILabel *lineLab = [[UILabel alloc] initWithFrame:CGRectMake(0, CELLH-1, kScreenWidth, 1)];
        lineLab.layer.borderWidth = 1;
        lineLab.layer.borderColor = [cellGrayColor CGColor];
        
        [self.contentView addSubview:self.rankNumLab];
        [self.contentView addSubview:self.rankHeaderView];
        [self.contentView addSubview:rankNCLab];
        [self.contentView addSubview:self.rankNameLab];
        [self.contentView addSubview:self.rankNumImgView];
        [self.contentView addSubview:rankImageView];
        [self.contentView addSubview:self.rankIntegralLab];
        [self.contentView addSubview:lineLab];
        
    }
    return self;
}

- (void)awakeFromNib {
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state考虑考虑空间链接了解了解了快乐健康
}

@end
